home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
alangsbs.zip
/
BYTE2STR.SRC
< prev
next >
Wrap
Text File
|
1989-12-12
|
1KB
|
35 lines
;---------------------------------------------------------------
; Byte2Str -- Converts a byte passed in AL to a string at
; DS:SI
; Last update 3/8/89
;
; 1 entry point:
;
; Byte2Str:
; Caller must pass:
; AL : Byte to be converted
; DS : Segment of destination string
; SI : Offset of destination string
;
; This routine converts 8-bit values to 2-digit hexadecimal
; string representations at DS:SI. The "H" specifier is
; *not* included. Four separate output examples:
; 02 B7 FF 6C
;---------------------------------------------------------------
Byte2Str PROC
mov DI,AX ; Duplicate byte in DI
and DI,000FH ; Mask out high 12 bits of DI
mov BX,OFFSET Digits ; Load offset of Digits into DI
mov AH,BYTE PTR [BX+DI] ; Load digit from table into AH
mov [SI+1],AH ; and store digit into string
xor AH,AH ; Zero out AH
mov DI,AX ; And move byte into DI
shr DI,1 ; Shift high nybble of byte to
shr DI,1 ; low nybble
shr DI,1
shr DI,1
mov AH,BYTE PTR [BX+DI] ; Load digit from table into AH
mov [SI],AH ; and store digit into string
ret ; We're done--go home!
Byte2Str ENDP